<template>
  <el-card :body-style="{ padding: '0px' }">
    <div style="width: 100%; height: 300px" ref="line"></div>
  </el-card>
</template>

<script>
import * as echarts from "echarts";
import { request } from "../../../../../api/request/index";
export default {
  data() {
    return {};
  },
  // created() {
  //   request({
  //     method: "post",
  //     url: "posts",
  //     data:{

  //     }
  //   }).then((res) => {
  //     console.log(res);
  //   });
  // },
  mounted() {
    var myChart = echarts.init(this.$refs.line);
    var option;
    option = {
      tooltip: {
        trigger: "axis",
      },
      legend: {},
      grid: {
        left: "3%",
        right: "4%",
        bottom: "3%",
        containLabel: true,
      },
      xAxis: {
        type: "category",
        boundaryGap: false,
        data: [
          "2020.6",
          "2020.7",
          "2020.8",
          "2020.9",
          "2020.10",
          "2020.11",
          "2020.12",
        ],
      },
      yAxis: {
        type: "value",
      },
      series: [
        {
          name: "华为",
          type: "line",
          stack: "Total",
          data: [120, 132, 101, 134, 90, 230, 210],
        },
        {
          name: "魅族",
          type: "line",
          stack: "Total",
          data: [220, 182, 191, 234, 290, 330, 310],
        },
        {
          name: "小米",
          type: "line",
          stack: "Total",
          data: [150, 232, 201, 154, 190, 330, 410],
        },
        {
          name: "oppo",
          type: "line",
          stack: "Total",
          data: [320, 332, 301, 334, 390, 330, 320],
        },
      ],
    };
    option && myChart.setOption(option);
  },
};
</script>

<style lang='less' scoped>
.el-card {
  margin: 20px 0;
}
</style>